﻿Public Class FormUsedRecord
    Dim objFlbInfo As New clsFlbInfo
    Dim objProdInfo As New clsProdInfo
    Private Sub FormMergeRecord_Load(sender As Object, e As EventArgs) Handles MyBase.Load

    End Sub
    Public Sub setDgvData()
        Dim dt As DataTable = objFlbInfo.getFlbInfoListByUsedStatus("0", txtDLNo.Text.Trim())
        dt.Columns.Add("which_side_name")
        If dt.Rows.Count > 0 Then
            For Each row As DataRow In dt.Rows
                If row("which_side") = "0" Then
                    row("which_side_name") = "朝上"
                Else
                    row("which_side_name") = "朝下"
                End If
            Next
        End If
        dgv.AutoGenerateColumns = False
        dgv.DataSource = dt
    End Sub

    Private Sub btnSearch_Click(sender As Object, e As EventArgs) Handles btnSearch.Click
        setDgvData()
    End Sub

    Public Sub setDgvDetailsData()
        Dim dtDetails As DataTable = objProdInfo.getProdInfoListByFlbSysId(dgv.SelectedRows(0).Cells("sys_id").Value.ToString())
        dgvDetails.AutoGenerateColumns = False
        dgvDetails.DataSource = dtDetails
    End Sub

    Private Sub dgv_SelectionChanged(sender As Object, e As EventArgs) Handles dgv.SelectionChanged
        If dgv.SelectedRows.Count > 0 Then
            setDgvDetailsData()
        End If
    End Sub
End Class